import md5 from 'js-md5'
/**
 * 生成指纹
 * @param windowInfo-窗口信息
 * @param deviceInfo-设备信息
 * @param appBaseInfo-小程序基础信息
 */
export const generateFingerPrint = (windowInfo, deviceInfo, appBaseInfo) => {
  const { pixelRatio, screenWidth, screenHeight } = windowInfo
  const { deviceBrand, deviceId, deviceModel, system, platform, osName } = deviceInfo
  const { SDKVersion, hostFontSizeSetting, hostTheme, hostVersion } = appBaseInfo
  const uid = new Date().getTime().toString()

  const info = `${uid}-${pixelRatio}-${screenWidth}-${screenHeight}-
  ${deviceBrand}-${deviceId}-
  ${deviceModel}-${system}-
  ${platform}-${osName}-
  ${SDKVersion}-${hostFontSizeSetting}-
  ${hostTheme}-${hostVersion}`

  return md5(info)
}